package com.yunxi.service.dubboService.impl.dealer;

import com.github.pagehelper.PageInfo;
import com.yunxi.dealer.pojo.PartnerAccountTransRecordVO;
import com.yunxi.dealer.service.PartnerAccountTransRecordDubboService;
import com.yunxi.model.dealer.PartnerAccountTransRecord;
import com.yunxi.service.localService.dealer.PartnerAccountTransRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 渠道商帐户交易记录 服务实现类
 * </p>
 *
 * @author
 * @since 2019-05-27
 */
public class PartnerAccountTransRecordDubboServiceImpl implements PartnerAccountTransRecordDubboService {

   @Autowired
   @Qualifier(value = "partnerAccountTransRecordServiceImpl")
   PartnerAccountTransRecordService partnerAccountTransRecordService;


   @Override
   public PartnerAccountTransRecordVO getById(String id) throws InvocationTargetException, IllegalAccessException {
      PartnerAccountTransRecord partnerAccountTransRecord = partnerAccountTransRecordService.getById(id);
      PartnerAccountTransRecordVO partnerAccountTransRecordVO = new PartnerAccountTransRecordVO();
      BeanUtils.copyProperties(partnerAccountTransRecord, partnerAccountTransRecordVO);
      return partnerAccountTransRecordVO;
   }

   @Override
   public void saveOrUpdate(PartnerAccountTransRecordVO partnerAccountTransRecordVO) throws InvocationTargetException, IllegalAccessException {
      PartnerAccountTransRecord partnerAccountTransRecord = new PartnerAccountTransRecord();
      BeanUtils.copyProperties(partnerAccountTransRecordVO, partnerAccountTransRecord);
      partnerAccountTransRecordService.saveOrUpdate(partnerAccountTransRecord);
   }

   @Override
   public void removeById(String id) {
      partnerAccountTransRecordService.removeById(id);
   }

   @Override
   public PageInfo<PartnerAccountTransRecordVO> findPageByVO(PartnerAccountTransRecordVO partnerAccountTransRecordVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
      PageInfo<PartnerAccountTransRecordVO> pageInfo = partnerAccountTransRecordService.pageByVo(partnerAccountTransRecordVO, pageNum, pageSize);
      return pageInfo;
   }

   @Override
   public void removeByListVo(List<PartnerAccountTransRecordVO> partnerAccountTransRecordVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
      partnerAccountTransRecordService.removeByListVo(partnerAccountTransRecordVOList);
   }

   @Override
   public void save(PartnerAccountTransRecordVO partnerAccountTransRecordVO) {
      PartnerAccountTransRecord partnerAccountTransRecord = new PartnerAccountTransRecord();
      BeanUtils.copyProperties(partnerAccountTransRecordVO, partnerAccountTransRecord);
      partnerAccountTransRecordService.save(partnerAccountTransRecord);
   }
}
